/**
 * FileName: TsfController
 * Author:   powersi
 * Date:     2021/1/1 11:49
 * Description: 1
 */
package com.zm.demo.httpclient;

import io.swagger.annotations.*;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.*;

/**
 * Description: 1
 * Author:      powersi
 * Date:        2021/1/1 11:49
 */
@RestController
@RequestMapping
@SpringBootApplication
@Api("tsf接口调用统计")
public class TsfController {


    public static void main(String[] args) {
        SpringApplication.run(TsfController.class, args);
    }

//    static List<String> list = new ArrayList<>();
//    static Map<String,String> mapParam = new HashMap<>();
//
//    static {
//        list.addAll(Arrays.asList(
//                "/fsi/api/fsiPsnInfoService/queryPsnInfo",
//                "/fsi/api/fsiDrugStoreService/drugstoreSettleAccounts",
//                "/fsi/api/outpatientDocInfoService/outpatientRregistration",
//                "/fsi/api/outpatientDocInfoService/outpatientFeeListUp",
//                "/fsi/api/outpatientSettleService/saveSettletment",
//                "/fsi/api/hospFeeDtlService/feeDtlUp",
//                "/fsi/api/hospSettService/sett",
//                "/fsi/api/fsiFixMedInsService/queryFixMedIns"
//        ));
//
//        mapParam.put("/fsi/api/fsiPsnInfoService/queryPsnInfo", "人员查询");
//        mapParam.put("/fsi/api/fsiFixMedInsService/queryFixMedIns", "医药机构信息获取");
//        mapParam.put("/fsi/api/fsiDrugStoreService/drugstoreSettleAccounts", "药店结算");
//        mapParam.put("/fsi/api/outpatientDocInfoService/outpatientRregistration", "门诊挂号");
//        mapParam.put("/fsi/api/outpatientDocInfoService/outpatientFeeListUp", "门诊费用明细信息上传");
//        mapParam.put("/fsi/api/outpatientSettleService/saveSettletment", "门诊结算");
//        mapParam.put("/fsi/api/hospFeeDtlService/feeDtlUp", "住院费用明细上传");
//        mapParam.put("/fsi/api/hospSettService/sett", "住院结算");
//        mapParam.put("/fsi/api/hospitalRegisterService/hospitalRegisterSave", "入院办理");
//        mapParam.put("/fsi/api/dscgService/dischargeProcess", "出院办理");
//
//    }
//
//    @ApiOperation(value = "接口调用统计", notes = "接口调用统计，包含：\"/fsi/api/fsiPsnInfoService/queryPsnInfo\",\n" +
//            "            \"/fsi/api/fsiDrugStoreService/drugstoreSettleAccounts\",\n" +
//            "            \"/fsi/api/outpatientDocInfoService/outpatientRregistration\",\n" +
//            "            \"/fsi/api/outpatientDocInfoService/outpatientFeeListUp\",\n" +
//            "            \"/fsi/api/outpatientSettleService/saveSettletment\",\n" +
//            "            \"/fsi/api/hospFeeDtlService/feeDtlUp\",\n" +
//            "            \"/fsi/api/hospSettService/sett\"")
//    @RequestMapping(value = "calc", method = RequestMethod.GET)
//    @ApiImplicitParams(
//            {@ApiImplicitParam(name = "host", required = true, paramType="query", dataType = "String", defaultValue = "173.16.179.92"),
//            @ApiImplicitParam(name = "startTime", required = true, paramType="query", dataType = "String", defaultValue = "2021-01-02 00:00:00"),
//            @ApiImplicitParam(name = "endTime", required = true, paramType="query", dataType = "String", defaultValue = "2021-01-02 23:00:00"),
//            @ApiImplicitParam(name = "incefaceName", required = true, paramType="query", dataType = "String", defaultValue = "test"),
//            @ApiImplicitParam(name = "cookie", required = true, paramType="query", dataType = "String", defaultValue = "accessToken=2ef92a753b8ef58767ee4fe03243a82f; JSESSIONID=E605692355D4C23F314ADFE80DD70FB2")}
//    )
//    public Map<String,Map<String, Object>> calc(
//            String host,
//            String startTime,
//            String endTime,
//            String incefaceName,
//            String cookie
//    ) throws Exception{
//        Map<String,Map<String, Object>> map = new HashMap<>();
//        if (incefaceName != null && incefaceName.length() > 0){
//            list.add(incefaceName);
//        }
//        for (String s : list) {
//            map.put(s, HttpUtil.calc(host, startTime, endTime, s, cookie));
//        }
//        return map;
//    }
//
//
//    @ApiOperation(value = "接口调用统计", notes = "接口调用统计，包含：\"/fsi/api/fsiPsnInfoService/queryPsnInfo\",\n" +
//            "            \"/fsi/api/fsiDrugStoreService/drugstoreSettleAccounts\",\n" +
//            "            \"/fsi/api/outpatientDocInfoService/outpatientRregistration\",\n" +
//            "            \"/fsi/api/outpatientDocInfoService/outpatientFeeListUp\",\n" +
//            "            \"/fsi/api/outpatientSettleService/saveSettletment\",\n" +
//            "            \"/fsi/api/hospFeeDtlService/feeDtlUp\",\n" +
//            "            \"/fsi/api/hospSettService/sett\"")
//    @RequestMapping(value = "traces", method = RequestMethod.GET)
//    @ApiImplicitParams(
//            {@ApiImplicitParam(name = "host", required = true, paramType="query", dataType = "String", defaultValue = "173.16.179.92"),
//                    @ApiImplicitParam(name = "startTime", required = true, paramType="query", dataType = "String", defaultValue = "2021-01-02 00:00:00"),
//                    @ApiImplicitParam(name = "endTime", required = true, paramType="query", dataType = "String", defaultValue = "2021-01-02 23:00:00"),
//                    @ApiImplicitParam(name = "incefaceName", required = false, paramType="query", dataType = "String", defaultValue = "test"),
//                    @ApiImplicitParam(name = "cookie", required = true, paramType="query", dataType = "String", defaultValue = "accessToken=2ef92a753b8ef58767ee4fe03243a82f; JSESSIONID=E605692355D4C23F314ADFE80DD70FB2")}
//    )
//    public Map<String,Map<String, Object>> traces(
//            String host,
//            String startTime,
//            String endTime,
//            String incefaceName,
//            String cookie
//    ) throws Exception{
//        Map<String,Map<String, Object>> map = new HashMap<>();
//        if (incefaceName != null && incefaceName.length() > 0){
//            list.add(incefaceName);
//        }
//        mapParam.entrySet().stream().forEach(e ->{
//            try {
//                map.put(e.getKey(), HttpUtil.traces(host, startTime, endTime, e, cookie));
//            } catch (Exception ex){
//                ex.printStackTrace();
//            }
//        });
//        return map;
//    }

}
